package com.wisesoft.ncp.repo;

import com.wisesoft.ncp.entity.VirusEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by lvchang on 2020/3/9.
 */
@Repository
public interface VirusRepository extends JpaRepository<VirusEntity, Long> {

    @Query(value = "select id, district, number from tb_virus", nativeQuery = true)
    public  List<VirusEntity> findAll();

    public List<VirusEntity> findByNumberLessThan(Integer number);

    @Query(value = "update tb_virus set district=?2, number=?3 where id=?1", nativeQuery = true)
    public void updateByDistrict(Long id, String district, Integer number);
}
